<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.title.zhuyonghu"/><spring:message code="message.button.add"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
							
    <section class="content-header">
        <h1><spring:message code="message.title.zhuyonghu"/><spring:message code="message.button.add"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first" /></a></li>
            <li class="active"><a href="#"><spring:message code="message.title.xiTongSheZhi" /></a></li>
             <li class="active"><a href="#"><spring:message code="message.title.yongHuGuanLi" /></a></li>
            <li class="active"><a href="#"><spring:message code="message.title.center_zhuyonghu" /></a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">
                    <div class="form-group form-group-xs">
                        <label for="searchPharCode"><spring:message code='message.lable.zhuanJiaXingMing'/>：</label>
                        <input class="form-control" type="text" id="name" placeholder="<spring:message code='message.lable.zhuanJiaXingMing'/>" maxlength="64" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="searchPharName"><spring:message code='message.lable.danwei'/>：</label>
                        <input class="form-control" type="text" id="companyId" placeholder="<spring:message code='message.lable.danwei'/>" maxlength="100" />
                    </div>
                    	<div class="form-group form-group-xs">
                        <label for="searchPharName"><spring:message code='message.lable.zhuanJiaLeiBie'/>：</label>
                         <select class="form-control" style="width:120px" id="expSkills">
                         	<option value=""><spring:message code="message.select.option"/></option>
                        		<c:if test="${ expSkillsList != null }">
									<c:forEach items="${expSkillsList}" var="exp">
										<option value="${exp}">${exp}</option>
									</c:forEach>
								</c:if>
                        </select>
                    </div>
                    <button type="button" class="btn btn-success btn-sm" onclick="search();"><spring:message code='message.button.seach'/></button>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
    <div class=" box box-warning bottongroup">
      		  <a href="${ctx}/sysUser/zxUserList.html" class="btn btn-default btn-sm"><spring:message code='message.button.getBack'/></a>
    	</div>
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    
    <script type="text/javascript">
    
    function generateAccount(name,id,userType){
    	$.HN.dialog.open({
             id:id,
             title:"<spring:message code="message.title.zhuyonghu"/><spring:message code="message.button.add"/>",
             url:"${ctx}/sysUser/toGenerateAccount.html?id="+id+"&userType="+userType+"&name="+name,
             width:"300px",
             height:"185px",
             closefunc:function(){
            	 search();
             }
         });
}
    	//查询
    	function search(page) {
    		var expSkills = $("#expSkills").val();
    		var name = $("#name").val();
    		var companyId = $("#companyId").val();
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{"expSkills":expSkills,"name":name, "companyId":companyId},
    	        page : (page || 1)
    	    }).trigger("reloadGrid"); //重新载入  
    	}
    
        $(function () {
        	$('.form-inline :input').bind('keydown', function(event) {if (event.keyCode == "13") {search();}}).eq(0).focus();
            $("#gridlist").jqGrid({
                url: "${ctx}/sysUser/getExpertList.html",
                mtype: "post",
                datatype: "json",
                autowidth: true,
                height: 270,
                colNames: ['<spring:message code='message.jqGrid.cz'/>',
                           '<spring:message code='message.lable.zhuanJiaBianHao'/>',
                           '<spring:message code='message.lable.zhuanJiaXingMing'/>',
                           '<spring:message code='message.lable.xingBie'/>',
                           '<spring:message code='message.lable.zhuanJiaLeiBie'/>',
                           '<spring:message code='message.lable.danwei'/>',
                           '<spring:message code='message.lable.zhiWu'/>',
                           '<spring:message code='message.lable.phone'/>',
                           '<spring:message code='message.lable.chuShengRiQi'/>',
                           '<spring:message code='message.lable.status'/>'],
                colModel: [
                           { name: 'operate', width: 10, align:"center", sortable: false,
                           	formatter : function(val, opts, rowdata) {
                           		var str="";
                           		str += "<a href='javascript:generateAccount(\""+rowdata.name+"\",\""+rowdata.expertId+"\",${userType});' ><spring:message code='message.lable.shengChengZhangHao'/></a>";
       	                    	return str;
                           }},
                    { name: 'expertCode', width: 10, align:"center", sortable: false},
                    { name: 'name', width: 12, align:"left", sortable: false },
                    { name: 'sex', width: 5, align:"center", sortable: false},
                    { name: 'expSkills', width: 13, align:"center", sortable: false},
                    { name: 'companyId', width: 30, align:"center", sortable: false},
                    { name: 'position', width: 8, align:"center", sortable: false},
                    { name: 'handphone', width: 10, align:"center", sortable: false},
                    { name: 'birthday', width: 10, align:"center", sortable: false},
                    { name: 'status', width: 5, align: 'center', sortable: false,
                    	formatter : function(val, opts, rowdata) {
                    		var str = "";
                    		if (rowdata.status == 1) {
								str += "<spring:message code='message.button.start'/>";
							}
							if (rowdata.status == 2) {
								str += "<spring:message code='message.button.stop'/>";
							}
                    		return str;
                    	}
                    }
                 
                ],
                rowNum: 20,
                rowList: [10, 20, 30],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "<spring:message code='message.lable.zhuanJiaLieBaio'/>",
                gridComplete:function(){
                    autoRNWidth("gridlist");
                },
                jsonReader: {
                    id: "expertId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
    </script>
</body>
</html>

